﻿using System;
using System.Collections.Generic;
using System.Net;

namespace ProxyFinder {
    /// <summary>
    /// This class is the basic implementation of the ICredentialProvider interface
    /// that supports returning the DefaultCredentials and an empty array of ICredentials for the GetCredentials method.
    /// </summary>
    public class DefaultCredentialProvider : ICredentialProvider {
        /// <summary>
        /// Returns a list of valid/possibly saved credentials for the given target.
        /// </summary>
        /// <param name="target">This is a key that the provider will use to look up credentials for.</param>
        /// <returns></returns>
        public virtual ICollection<ICredentials> GetCredentials(string target) {
            if(string.IsNullOrEmpty(target)) {
                throw new ArgumentNullException("target");
            }
            return new NetworkCredential[0];
        }

        /// <summary>
        /// Returns default system credentials.
        /// </summary>
        public virtual ICredentials DefaultCredentials {
            get {
                return CredentialCache.DefaultCredentials;
            }
        }
    }
}
